package com.ssyc.gsk_teacher.activity;

import android.content.Intent;
import android.view.View;
import android.widget.ImageView;

import com.ssyc.common.base.BaseActivity;
import com.ssyc.gsk_teacher.R;

/**
 * 教师端--教学与反思主界面
 * Created by Kevin on 2018/6/25
 */

public class TeacherFansiMainActivity extends BaseActivity implements View.OnClickListener {

    //返回键
    private ImageView ivBack;

    //教学目标
    private ImageView lvTeach;

    //重难点
    private ImageView lvHard;

    //Tab页面选中的资源图片集合
    private int[] tabSelectIds = {R.drawable.teacher_teach_select, R.drawable.teacher_hard_selectl};

    //Tab页面未选中的资源图片集合
    private int[] tabUnselectIds = {R.drawable.teacher_teach_normal, R.drawable.teacher_hard_normal};

    //gradeID
    private String gradeId;

    private String lessonId;

    private String classId;

    private ImageView iv_mysikao;
    @Override
    protected boolean isNeedShowTitle() {
        return false;
    }

    @Override
    protected String setTitleText() {
        return null;
    }

    @Override
    protected int getContentLayout() {
        return R.layout.teacher_activity_fansi_main;
    }

    @Override
    protected void init() {

        showContent();

        //初始化视图
        initView();

        //接收数据
        InitIntent();

    }

    /**
     * 接收数据
     */
    private void InitIntent() {
        gradeId = getIntent().getStringExtra("gradeId");
        lessonId = getIntent().getStringExtra("lessonId");
        classId = getIntent().getStringExtra("classId");
    }

    /**
     * 初始化视图的方法
     */
    public void initView() {
        ivBack = findViewById(R.id.iv_back);
        ivBack.setOnClickListener(this);
        lvTeach = findViewById(R.id.lv_teach);
        lvTeach.setOnClickListener(this);
        lvHard = findViewById(R.id.lv_hard);
        lvHard.setOnClickListener(this);
        iv_mysikao = findViewById(R.id.iv_mysikao);
        iv_mysikao.setOnClickListener(this);
    }


    /**
     * 点击事件
     *
     * @param v
     */
    @Override
    public void onClick(View v) {
        int id = v.getId();
        if (id == R.id.iv_back) {
            finish();
        } else if (id == R.id.lv_teach) {
            //教学目标
            lvTeach.setImageResource(tabSelectIds[0]);
            lvHard.setImageResource(tabUnselectIds[1]);

        } else if (id == R.id.lv_hard) {
            //重难点
            lvTeach.setImageResource(tabUnselectIds[0]);
            lvHard.setImageResource(tabSelectIds[1]);

        }else if (id == R.id.iv_mysikao) {
            //我的思考
            Intent intent = new Intent(this,TeacherMyFansiActivity.class);
            intent.putExtra("gradeId",gradeId);
            intent.putExtra("lessonId",lessonId);
            intent.putExtra("classId",classId);
            startActivity(intent);
        }
    }
}
